<!DOCTYPE html>
<html lang="cn" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <title>系统设置 Setting Form</title>
  <meta name="renderer" content="webkit"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
  <link rel="stylesheet" th:href="@{/statics/layui/css/layui.css}" media="all"/>
  <link rel="stylesheet" th:href="@{/statics/style/admin.css}" media="all"/>
  <style type="text/css">
    html{
      background-color: #FFF;
    }
    .pic {
      margin-left: 130px;
    }

    .pic dl {
      float: left;
      position: relative;
    }

    .pic dl dd {
      position: absolute;
      right: 5px;
      top: 5px;
      cursor: pointer;
      background: #666;
      color: #fff;
      padding: 2px;
    }

    .pic img {
      height: 100px;
      margin: 5px 0;
      margin-right: 5px;
    }

  </style>
</head>
<body>
  <div class="layui-form" lay-filter="layuiadmin-sys-setting" id="layuiadmin-sys-setting" style="padding: 0px 5px;">
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li class="layui-this">基本选项</li>
        <li>日志设置</li>
        <li>阿里云OSS</li>
      </ul>
      <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
          <div class="layui-form-item">
            <label class="layui-form-label">后台验证码</label>
            <div class="layui-input-block">
              <input type="checkbox" name="sys_check_code" style="float: left" lay-skin="switch" th:checked="${config['sys_check_code'] eq '1' }"/>
              <div class="layui-form-mid layui-word-aux"></div>
            </div>
          </div>
        </div>
        <div class="layui-tab-item">
          <div class="layui-form-item">
            <label class="layui-form-label">日志方法</label>
            <div class="layui-input-block">
              <input type="checkbox" name="sys_log_method_1" value="GET" lay-filter="sys_log_method_filter" title="GET" th:checked="${#strings.containsIgnoreCase(config['sys_log_method'] , 'GET')}"/>
              <input type="checkbox" name="sys_log_method_1" value="POST" lay-filter="sys_log_method_filter" title="POST" th:checked="${#strings.containsIgnoreCase(config['sys_log_method'], 'POST')}"/>
              <input type="checkbox" name="sys_log_method_1" value="DELETE" lay-filter="sys_log_method_filter" title="DELETE" th:checked="${#strings.containsIgnoreCase(config['sys_log_method'], 'DELETE')}"/>
              <input type="checkbox" name="sys_log_method_1" value="PUT" lay-filter="sys_log_method_filter" title="PUT" th:checked="${#strings.containsIgnoreCase(config['sys_log_method'] , 'PUT')}"/>
              <div class="layui-form-mid layui-word-aux">系统日志记录方法</div>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">系统日志</label>
            <div class="layui-input-block">
              <input type="text" name="sys_log_dates" autocomplete="off" placeholder="系统日志保留天数"
                     class="layui-input" th:value="${config['sys_log_dates']}"/>
              <div class="layui-form-mid layui-word-aux">系统日志保留天数</div>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">登录日志</label>
            <div class="layui-input-block">
              <input type="text" name="sys_log_login_dates " autocomplete="off" placeholder="登录日志保留天数"
                     class="layui-input" th:value="${config['sys_log_login_dates']}"/>
              <div class="layui-form-mid layui-word-aux">登录日志保留天数</div>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">任务日志</label>
            <div class="layui-input-block">
              <input type="text" name="sys_log_task_dates" autocomplete="off" placeholder="任务日志保留天数"
                     class="layui-input" th:value="${config['sys_log_task_dates']}"/>
              <div class="layui-form-mid layui-word-aux">任务日志保留天数</div>
            </div>
          </div>
        </div>
        <div class="layui-tab-item">
          <div class="layui-form-item">
            <label class="layui-form-label">开启 OSS</label>
            <div class="layui-input-block">
              <input type="checkbox" name="sys_aliyun_oss_enable" style="float: left" lay-skin="switch" th:checked="${config['sys_aliyun_oss_enable'] eq '1' }"/>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">EndPoint</label>
            <div class="layui-input-block">
              <input type="text" name="sys_aliyun_oss_endpoint" autocomplete="off" placeholder="EndPoint"
                     class="layui-input" th:value="${config['sys_aliyun_oss_endpoint']}"/>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">KeyId</label>
            <div class="layui-input-block">
              <input type="text" name="sys_aliyun_oss_keyid" autocomplete="off" placeholder="KeyId"
                     class="layui-input" th:value="${config['sys_aliyun_oss_keyid']}"/>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">KeySecret</label>
            <div class="layui-input-block">
              <input type="text" name="sys_aliyun_oss_keysecret" autocomplete="off" placeholder="KeySecret"
                     class="layui-input" th:value="${config['sys_aliyun_oss_keysecret']}"/>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">BucketName</label>
            <div class="layui-input-block">
              <input type="text" name="sys_aliyun_oss_bucketname" autocomplete="off" placeholder="BucketName"
                     class="layui-input" th:value="${config['sys_aliyun_oss_bucketname']}"/>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">FileHost</label>
            <div class="layui-input-block">
              <input type="text" name="sys_aliyun_oss_filehost" autocomplete="off" placeholder="FileHost"
                     class="layui-input" th:value="${config['sys_aliyun_oss_filehost']}"/>
            </div>
          </div>
        </div>
      </div>
    <div class="layui-form-item layui-hide">
      <input type="hidden" id="sys_log_method" name="sys_log_method" th:value="${config['sys_log_method']}"/>
      <button class="layui-btn" lay-submit lay-filter="LAY-sys-setting-submit" id="LAY-sys-setting-submit">提交</button>
    </div>
  </div>

  <script th:src="@{/statics/layui/layui.js}"></script>
  <script>
  layui.config({
    base: '/statics/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,form = layui.form ;

      var methods = [];
      methods = $('#sys_log_method').val().split(',');
      form.on('checkbox(sys_log_method_filter)', function(data){
          if(data.elem.checked){
              methods.push(data.value);
          }else{
              methods.splice($.inArray(data.value,methods),1);
          }
          $('#sys_log_method').val(methods.join(','));
      });

  });
  </script>
</body>
</html>